//
// Created by Shao Wenhan on 2021/5/18.
//

#include "ConfigurableEventListener.h"
#include "DefineProblemType.h"
#include "gmock/gmock.h"

TEST(TestDefineProblemType, Constraints)
{
#if defined(MDVRP)
    ASSERT_THAT(constraints, ElementsAre(vehicleCap, duration));
    ASSERT_THAT(loadRelatedCons, ElementsAre(vehicleCap));
    ASSERT_THAT(timeRelatedCons, ElementsAre(duration));
#elif defined(MDOVRP)
    ASSERT_THAT(constraints, ElementsAre(vehicleCap));
    ASSERT_THAT(loadRelatedCons, ElementsAre(vehicleCap));
#elif defined(LRP)
    ASSERT_THAT(constraints, ElementsAre(vehicleCap, depotCap));
    ASSERT_THAT(loadRelatedCons, ElementsAre(vehicleCap, depotCap));
#elif defined(GVRP) or defined(MDGVRP)
    ASSERT_THAT(constraints, ElementsAre(range, duration));
    ASSERT_THAT(rangeRelatedCons, ElementsAre(range));
    ASSERT_THAT(timeRelatedCons, ElementsAre(duration));
#endif

#if defined(MDVRP) and (not defined(Cons_vehicleCap) or not defined(Cons_duration) or not defined(Cons_tourNum) or not defined(Symmetrical))
#elif defined(MDOVRP) and (not defined(Cons_vehicleCap) or not defined(OpenRoutes) or not defined(Symmetrical))
#elif defined(LRP) and (not defined(Cons_vehicleCap) or not defined(Cons_depotCap) or not defined(Symmetrical))
#elif (defined(GVRP) or defined(MDGVRP)) and (not defined(Cons_duration) or not defined(Cons_range) or not defined(Symmetrical))
    exit(1);
#endif
}

TEST(TestDefineProblemType, Instance){
#if defined(MDVRP) and not defined(ServiceTime)
#elif defined(LRP) and (not defined(VehicleCost) or not defined(DepotCost))
#elif (defined(MDGVRP) or defined(GVRP)) and (not defined(FuelStation) or not defined(ServiceTime) or not defined(FuelTime) or not defined(Speed))
#elif (defined(MDGVRP) or defined(MDVRP) or defined(MDOVRP) or defined(LRP)) and not defined(MultiDepots)
#elif defined(GVRP) and defined(MultiDepots)
    exit(1);
#endif
}

GTEST_API_ int main(int argc, char **argv)
{
    testing::InitGoogleTest(&argc, argv);
    initialGTest();
    return RUN_ALL_TESTS();
}
